'use strict';

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }

var updateVersion = function updateVersion() {
	var newSearch = '?' + Obj2URL(Object.assign(URLparams, {
		v: new Date().getTime()
	}));
	location.href = location.origin + location.pathname + newSearch + location.hash;
};

var URL2Obj = function URL2Obj(u) {
	return u ? Object.assign.apply(Object, _toConsumableArray(u.split('&').filter(function (e) {
		return e;
	}).map(function (e) {
		return function (a, b) {
			return _defineProperty({}, a, b);
		}.apply(undefined, _toConsumableArray(e.split('=')));
	}))) : {};
};

var Obj2URL = function Obj2URL(o) {
	return Object.keys(o).map(function (e) {
		return e + '=' + o[e];
	}).join('&');
};

var URLconfig = URL2Obj(location.href.match(/([^\?]+)/g)[2]);
var URLparams = URL2Obj(location.search.slice(1));

var isOver = new Date().getTime() - 30000 > Number(URLparams.v);

if (!URLparams.v || isOver) updateVersion();

window.TF = {
	Obj2URL: Obj2URL,
	URL2Obj: URL2Obj
};

window.GD = {
	URLconfig: URLconfig,
	URLparams: URLparams
};